import java.util.Random;
/**
 * Process
 * 
 * @author () 
 * @version (10/19/09)
 */
public class Process  {
    // important
	private static int process_count = 0;
	
	private int id;
    private int total_cpu_time;
	private int cpu_time_used;
	private int io_interrupt_time, total_io_time;
	
	// private int priority;
	// private int memory_size;

    public Process(int cpu_length, int io_int_time, int io_length) {
		id = process_count;
		process_count++;
		total_cpu_time = cpu_length;
		cpu_time_used = 0;
		io_interrupt_time = io_int_time;
		total_io_time = io_length;
	}
	
	public String toString() {
		return "Process: " + id + "(" + cpu_time_used + "/" + total_cpu_time + ")";
	}
	
	static Process random() {
		Random rng = new Random();
		int cpu_length = rng.nextInt(40)+5;
		int io_int_time = rng.nextInt(cpu_length-4)+2;
		int io_length = rng.nextInt(cpu_length - io_int_time) + 1;
		return new Process(cpu_length, io_int_time, io_length);
	}
}
